<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>HTSC-财经新闻情感分析系统</title>

        <!-- CSS -->
        <link rel="stylesheet" href="css/reset.css">
        <link rel="stylesheet" href="css/supersized.css">
        <link rel="stylesheet" href="css/style.css">

        <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
        <!--[if lt IE 9]>
            <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->

    </head>
    <script type="text/javascript">
	    function findByName() {
			$.ajax({ 
		        url: "queryUsername.do", 
		        data: "username=" + $("#username").val(),  
		        type: "GET",  
		        dataType: 'json',   
		        contentType: "application/json; charset=utf-8",
		        error:function(data){  
		            alert("发生错误");  
		        },  
		        success:function(data){
		            if(data == 'findusername'){
		            	alert("用户名已存在");
		            	document.getElementById("name").value="";
		            }  
		        }
		   });  
		}
    </script>
	
	

    <body>

        <div class="page-container">
            <h1>注册</h1>
            <form action="register.do" method="post">
                <input type="text" id= "username" name="username" class="username" placeholder="用户名" onblur="findByName()">         
                <input type="password" name="password" class="password" placeholder="密码">
                <button type="submit" id=regist>注册</button>
                <button type="reset">重置</button>
                <button type="button" onclick="javascrtpt:window.location.href='login.jsp'">返回登录</button>
            </form>
        </div>
		
        <!-- Javascript -->
        <script src="js/jquery-1.8.2.min.js"></script>
        <script src="js/supersized.3.2.7.min.js"></script>
        <script src="js/supersized-init.js"></script>
        <script src="js/scripts.js"></script>
        <script src="myjs/findname.js"></script>
        

    </body>

</html>



